package com.zhixi.pattern.notimportant.adapterpattern.operation;

/**
 * 适配器类
 *
 * @作者 ShuHaoNan
 * @邮箱 shuhaonan1@gmail.com
 * @时间 2020/11/17 16:59
 */
public class VoltageAdapter implements Voltage5V {

    private IVoltage220V voltage220V;
    private int srcV;

    public VoltageAdapter(IVoltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        if (voltage220V != null) {
            this.srcV = voltage220V.output220V();
        }
        /* 降压 */
        return this.srcV / 44;
    }

}
